package com.roundarch.www.service.impl;

import java.util.List;

import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.roundarch.www.DataEntity;
import com.roundarch.www.dao.EntityDao;
import com.roundarch.www.service.EntityService;

public class EntityServiceImpl implements EntityService {

	private EntityDao entityDao;
	
	public EntityDao getEntityDao() {
		return entityDao;
	}

	public void setEntityDao(EntityDao entityDao) {
		this.entityDao = entityDao;
	}

	@Transactional
	public <T extends DataEntity> T find(long id, Class<T> c) {
		return entityDao.find(id, c);
	}

	@Transactional
	public <T extends DataEntity> List<T> listAll(Class<T> c) {
		return entityDao.listAll(c);
	}

	@Transactional
	public <T extends DataEntity> void save(T file) {
		entityDao.save(file);
	}

	@Transactional
	public <T extends DataEntity> void delete(long id, Class<T> c) {
		entityDao.delete(id, c);
	}

	@Transactional
    public <T extends DataEntity> T find(Class<T> entityClass, String propertyName, Object propertyValue)
    {
    	return entityDao.find(entityClass, propertyName, propertyValue);
    }
}
